<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="container-div">
	<div class="tabs-container">
		<div class="wrapper wrapper-content animated fadeInRight ibox-content">
			<form class="form-horizontal m" id="form-integralConfig-edit" th:object="${integralConfig}">
				<ul class="nav nav-tabs">
					<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true"> 积分配置</a></li>
					<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false"> 积分规则</a></li>
				</ul>
				<div class="tab-content">
					<div id="tab-1" class="tab-pane active">
						<div class="form-group"></div>
						<input id="companyId" name="companyId"  th:field="*{companyId}"  type="hidden">
						<input id="configId" name="configId" th:field="*{configId}"  type="hidden">
						<div class="form-group">
							<label class="col-sm-1 control-label"><span style="color: red">*</span>上报故障：</label>
							<div class="col-sm-3">
								<input id="reportFault" name="reportFault" th:field="*{reportFault}" class="form-control" type="text" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label"><span style="color: red">*</span>上报困人：</label>
							<div class="col-sm-3">
								<input id="reportTiring" name="reportTiring" th:field="*{reportTiring}" class="form-control" type="text" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label"><span style="color: red">*</span>故障维修：</label>
							<div class="col-sm-3">
								<input id="faultRepair" name="faultRepair" th:field="*{faultRepair}" class="form-control" type="text" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label"><span style="color: red">*</span>电梯保养：</label>
							<div class="col-sm-3">
								<input id="elevatorUpkeep" name="elevatorUpkeep" th:field="*{elevatorUpkeep}" class="form-control" type="text" required>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group" style="text-align: center">
							<div class="col-sm-5"></div>
							<div class="col-sm-1">
								<a class="btn btn-success" style="margin-left: 5px" href="javascript:void(0)" onclick="submitHandler()">保存</a>
							</div>
							<div class="col-sm-1">
								<a class="btn btn-danger" style="margin-left: 5px" href="javascript:void(0)"  onclick="closeItem()">关闭</a>
							</div>
							<div class="col-sm-5"></div>
						</div>
					</div>
					<div id="tab-2" class="tab-pane">
						<div class="form-group"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label"></label>
							<div class="col-sm-8">
								<input id="tinymceEditor" name="integralRules" th:field="*{integralRules}" class="form-control" type="text">
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group" style="text-align: center">
							<div class="col-sm-5"></div>
							<div class="col-sm-1">
								<a class="btn btn-success" style="margin-left: 5px" href="javascript:void(0)" onclick="submitHandler()">保存</a>
							</div>
							<div class="col-sm-1">
								<a class="btn btn-danger" style="margin-left: 5px" href="javascript:void(0)"  onclick="closeItem()">关闭</a>
							</div>
							<div class="col-sm-5"></div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
    <div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/tinymce/4.9.2/tinymce.min.js}"></script>
    <script type="text/javascript">
		var prefix = ctx + "business/integralConfig";
		$("#form-integralConfig-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
				var html = tinymce.activeEditor.getContent();
				$("#tinymceEditor").val(html);
				$.ajax({
					url: prefix + "/edit",
					data: $('#form-integralConfig-edit').serialize(),
					type: "post",
					processData: false,
					contentType: false,
					success: function(result) {
						$.modal.alertSuccess("保存成功")
					}
				});
	        }
	    }
	</script>
</body>
</html>
